import rtconfig
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.

src = Glob('STM32F7xx_HAL_Driver/Src/*.c')
src += Split('''
CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c
''')

#add for startup script
if rtconfig.CROSS_TOOL == 'gcc':
     src = src + ['CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup_stm32f769xx.s']
elif rtconfig.CROSS_TOOL == 'keil':
     src = src + ['CMSIS/Device/ST/STM32F7xx/Source/Templates/arm/startup_stm32f769xx.s']
elif rtconfig.CROSS_TOOL == 'iar':
    src = src + ['CMSIS/Device/ST/STM32F7xx/Source/Templates/iar/startup_stm32f769xx.s']

path = [cwd + '/STM32F7xx_HAL_Driver/Inc',
    cwd + '/CMSIS/Device/ST/STM32F7xx/Include',
    cwd + '/CMSIS/Include']

CPPDEFINES = ['STM32F769xx', 'USE_HAL_DRIVER']

group = DefineGroup('STM32_HAL', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
